<?php
class MChitietsanpham extends CI_Model{
    private $machitiet;
    private $manhinh;
    private $cpu;
    private $ram;
    private $hedieuhanh;
    private $camerachinh;
    private $cameraphu;
    private $bonhotrong;
    private $thenhongoai;
    private $pin;
    private $trongluong;
    public function __construct() {
        parent::__construct();
        $this->load->database();
        $this->OnCreate();
    }
    public function OnCreate(){
        $this->machitiet = '';
        $this->cpu ="";
        $this->manhinh = '';
        $this->ram = '';
        $this->camerachinh='';
        $this->cameraphu='';
        $this->hedieuhanh = '';
        $this->bonhotrong = '';
        $this->thenhongoai = '';
        $this->pin = '';
        $this->trongluong = '';
    }
    
    public function set_machitiet($data) {
        $this->machitiet = $data;
    }
    public function set_cpu($data) {
        $this->cpu = $data;
    }
    public function set_manhinh($data) {
        $this->manhinh = $data;
    }
    public function set_ram($data) {
        $this->ram = $data;
    }
    public function set_camerachinh($data) {
        $this->camerachinh = $data;
    }
    public function set_cameraphu($data) {
        $this->cameraphu = $data;
    }
    public function set_hedieuhanh($data) {
        $this->hedieuhanh = $data;
    }
    public function set_bonhotrong($data) {
        $this->bonhotrong = $data;
    }
    public function set_thenhongoai($data) {
        $this->thenhongoai = $data;
    }
    public function set_pin($data) {
        $this->pin = $data;
    }
    public function set_trongluong($data) {
        $this->trongluong = $data;
    }
    /////////////////get
    public function get_machitiet() {
        return $this->machitiet;
    }
    public function get_manhinh() {
        return $this->manhinh;
    }
    public function get_cpu() {
        return $this->cpu;
    }
    public function get_camerachinh() {
        return $this->camerachinh;
    }
    public function get_cameraphu() {
        return $this->cameraphu;
    }
    public function get_hedieuhanh() {
        return $this->hedieuhanh;
    }
    public function get_bonhotrong() {
        return $this->bonhotrong;
    }
    public function get_thenhongoai() {
        return $this->thenhongoai;
    }
    public function get_ram() {
        return $this->ram;
    }
    public function get_pin() {
        return $this->pin;
    }
    public function get_trongluong() {
        return $this->trongluong;
    }
    public function getOject($strWhere) {
        //$this->Oncreate();
        $this->db->from("chitietsanpham");
        $this->db->where($strWhere);
        // $this->db->join('loaitk', 'taikhoan.loaitk=loaitaikhoan.loaitk');
        $query = $this->db->get();
        $ar = $query->row_array();
        if (!empty($ar)) {
            $this->machitiet    = $ar["machitiet"];
            $this->manhinh      = $ar["manhinh"];
            $this->cpu          = $ar["cpu"];
            $this->ram          = $ar["ram"];
            $this->hedieuhanh   = $ar["hedieuhanh"];
            $this->bonhotrong   = $ar["bonhotrong"];
            $this->thenhongoai   = $ar["thenhongoai"];
            $this->camerachinh  = $ar["camerachinh"];
            $this->cameraphu    = $ar["cameraphu"];
            $this->pin          = $ar["pin"]; 
            $this->trongluong   = $ar["trongluong"]; 
        }
        return $ar;
    }
}
?>